package com.ctshk.common.enums;

/**
 * <p>
 *  会员等级枚举类
 * </p>
 *
 * @author 李新科
 * @date 2021/6/17 13:39
 */
public enum MemberLevel {
    SILVER(1,"银星会员",0,0,0,0,"一级会员"),
    GOLD(2,"金星会员",5000,10,1500,3,"二级会员"),
    PLATINUM(3,"铂星会员",60000,50,18000,15,"三级会员"),
    FIVESTARS(4,"五星会员",120000,100,36000,30,"四级会员"),
    ;
    /**
     * 定级消费积分
     */
    private int ratingPoint;

    /**
     * 定级级消费次数
     */
    private int ratingConsumptionTimes;

    /**
     * 保级消费积分
     */
    private int keepPoint;

    /**
     * 保级消费次数
     */
    private int keepConsumptionTimes;

    /**
     * 会员等级
     */
    private int level;

    /**
     * 会员等级名称
     */
    private String levelName;

    /**
     * 星赏会会员等级名称
     */
    private String memberTierName;

    MemberLevel(int level, String levelName, int ratingPoint, int ratingConsumptionTimes, int keepPoint, int keepConsumptionTimes,String memberTierName) {
        this.level = level;
        this.levelName = levelName;
        this.ratingPoint = ratingPoint;
        this.ratingConsumptionTimes = ratingConsumptionTimes;
        this.keepPoint = keepPoint;
        this.keepConsumptionTimes = keepConsumptionTimes;
        this.memberTierName = memberTierName;
    }

    public int getRatingPoint() {
        return ratingPoint;
    }

    public void setRatingPoint(int ratingPoint) {
        this.ratingPoint = ratingPoint;
    }

    public int getRatingConsumptionTimes() {
        return ratingConsumptionTimes;
    }

    public void setRatingConsumptionTimes(int ratingConsumptionTimes) {
        this.ratingConsumptionTimes = ratingConsumptionTimes;
    }

    public int getKeepPoint() {
        return keepPoint;
    }

    public void setKeepPoint(int keepPoint) {
        this.keepPoint = keepPoint;
    }

    public int getKeepConsumptionTimes() {
        return keepConsumptionTimes;
    }

    public void setKeepConsumptionTimes(int keepConsumptionTimes) {
        this.keepConsumptionTimes = keepConsumptionTimes;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getLevelName() {
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }

    public String getMemberTierName() {
        return memberTierName;
    }

    public void setMemberTierName(String memberTierName) {
        this.memberTierName = memberTierName;
    }

    public static MemberLevel getByLevel(int level) {
        MemberLevel[] values = MemberLevel.values();
        for (MemberLevel value : values) {
            if(level == value.getLevel()) {
                return value;
            }
        }
        return null;
    }

    public static MemberLevel getNextLevel(int level) {
        if(level == MemberLevel.FIVESTARS.getLevel()) {
            return MemberLevel.FIVESTARS;
        } else {
            return getByLevel(level + 1);
        }
    }

}
